package com.ruoyi.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.InventoryDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.InventoryDetailMapper;
import com.ruoyi.inventory.domain.InventoryByIdDetail;
import com.ruoyi.inventory.service.IInventoryDetailService;
import com.ruoyi.common.core.text.Convert;

/**
 * inventoryService业务层处理
 * 
 * @author ruoyi
 * @date 2019-10-29
 */
@Service
public class InventoryDetailServiceImpl implements IInventoryDetailService 
{
    @Autowired
    private InventoryDetailMapper inventoryDetailMapper;

    /**
     * 查询inventory
     * 
     * @param id inventoryID
     * @return inventory
     */
    @Override
    public InventoryByIdDetail selectInventoryDetailById(Long id)
    {
        return inventoryDetailMapper.selectInventoryDetailById(id);
    }

    /**
     * 查询inventory列表
     * 
     * @param inventoryDetail inventory
     * @return inventory
     */
    @Override
    public List<InventoryDetail> selectInventoryDetailList(InventoryDetail inventoryDetail)
    {
        return inventoryDetailMapper.selectInventoryDetailList(inventoryDetail);
    }

    /**
     * 新增inventory
     * 
     * @param inventoryDetail inventory
     * @return 结果
     */
    @Override
    public int insertInventoryDetail(InventoryDetail inventoryDetail)
    {
        inventoryDetail.setCreateTime(DateUtils.getNowDate());
        return inventoryDetailMapper.insertInventoryDetail(inventoryDetail);
    }

    /**
     * 修改inventory
     * 
     * @param inventoryDetail inventory
     * @return 结果
     */
    @Override
    public int updateInventoryDetail(InventoryDetail inventoryDetail)
    {
        inventoryDetail.setUpdateTime(DateUtils.getNowDate());
        return inventoryDetailMapper.updateInventoryDetail(inventoryDetail);
    }

    /**
     * 删除inventory对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteInventoryDetailByIds(String ids)
    {
        return inventoryDetailMapper.deleteInventoryDetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除inventory信息
     * 
     * @param id inventoryID
     * @return 结果
     */
    @Override
    public int deleteInventoryDetailById(Long id)
    {
        return inventoryDetailMapper.deleteInventoryDetailById(id);
    }

    /**
     * 查看盘点汇总
     * @param inventory
     * @return
     */
    @Override
    public List<InventoryByIdDetail> selectAllListById(InventoryByIdDetail inventory) {
        return inventoryDetailMapper.selectAllListById(inventory);
    }

    /**
     * 查询资产本次盘点相符数量
     * @param inventoryId
     * @return
     */
    @Override
    public List<InventoryByIdDetail> selectYesCountByAssetId(String inventoryId) {
        return inventoryDetailMapper.selectYesCountByAssetId(inventoryId);
    }

    /**
     * 查询资产本次盘点不相符数量
     * @param inventoryId
     * @return
     */
    @Override
    public List<InventoryByIdDetail> selectNoCountByAssetId(String inventoryId) {
        return inventoryDetailMapper.selectNoCountByAssetId(inventoryId);
    }
}
